-
-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Split RapierContext #585
Split RapierContext #585
Conversation
I'm not totally convinced yet, this leads to unfortunate API impacts to users, + bevy_mod_debugdump a bit difficult to parse, see jakobhellermann/bevy_mod_debugdump#50
… new RapierContext once we've split everything
8a05e9a
to
3e98da1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
…d confusion with bevy ecs World
let context = rapier_context.single(); | ||
// Then cast the ray. | ||
let hit = rapier_context.cast_ray( | ||
let hit = context.cast_ray( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could avoid this indirection to single()
if we implemented all methods of RapierContext
on its systemParam ; but:
- it would require making the query each time we call a method
- Probably not so much of an issue if queries are cached
- it would require to add another 400 lines of code, I already fear for the maintenance of current layer of indirection, I'd like to keep it at the minimum.
- a declarative macro to generate those ended up a bit too complex, and not much lines saved
- maybe a procedural or a template step could be interesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of added lines come from this file, which holds a shortcut to functions users are accustomed to. Rather than looking up which component they have to rely on, they have a RapierContext
-like API, and can look into it to see what queries it resolves to if they want.
RapierContext
#502RapierContextSimulation
RapierContext
is now aQueryData
aggregating all previously available information from that.Opportunities for parallelized execution seem limited, but exist, this also enables better separation of systems, with more typed information leading to a clearer intent.
I'm not 100% convinced it's a net positive in terms of maintainability, bevy_mod_debugdump is currently harder to read due to this bug: jakobhellermann/bevy_mod_debugdump#50.